from typing import Iterator, Optional

from jobs_agency.basics import JobEssence, JobsStore


class FakeStore(JobsStore):
    def __init__(self, job_essence: JobEssence | None = None):
        self.job_essence = job_essence

    def save_job(self, job_id: Optional[str], job_essence: JobEssence) -> str:
        self.job_essence = job_essence
        return ""

    def load_job(self, job_id: str) -> JobEssence:
        return self.job_essence

    def remove_job(self, job_id: str):
        pass

    def iter_jobs_id(self) -> Iterator[str]:
        yield ""
